import request from "@/utils/request";

export const reqGetSpuSaleAttrList = (spuId) =>
  request({ url: `/admin/product/spuSaleAttrList/${spuId}`, method: "get" });

export const reqGetSpuImgList = (spuId) =>
  request({ url: `/admin/product/spuImageList/${spuId}`, method: "get" });

export const reqGetAttrInfoList = (category1Id, category2Id, category3Id) =>
  request({
    url: `/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`,
    method: "get",
  });

export const reqSaveSkuInfo = (skuInfo) =>
  request({ url: "/admin/product/saveSkuInfo", method: "post", data: skuInfo });

export const reqGetSkuList = (page, limit) =>
  request({ url: `/admin/product/list/${page}/${limit}`, method: "get" });

// 上架
export const reqOnSale = (skuId) =>
  request({ url: `/admin/product/onSale/${skuId}`, method: "get" });
// 下架
export const reqCancel = (skuId) =>
  request({ url: `/admin/product/cancelSale/${skuId}`, method: "get" });
export const reqGetSkuInfo = (skuId) =>
  request({ url: `/admin/product/getSkuById/${skuId}`, method: "get" });

export const reqDeleteSku = (skuId) =>
  request({
    url: `/admin/product/deleteSku/${skuId}`,
    method: "delete",
  });
